package com.ikkong.biz.excel;

import com.ikkong.biz.model.Student;
import com.ikkong.biz.service.ClassesService;
import com.ikkong.biz.service.impl.ClassesServiceImpl;
import com.ikkong.core.toolbox.Conver;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Hyperlink;
import org.jeecgframework.poi.handler.impl.ExcelDataHandlerDefaultImpl;
import org.jeecgframework.poi.handler.inter.IExcelDataHandler;

import java.util.Map;

/**
 * Created by linyu on 2016/11/17.
 */
public class StudentDataHandler extends ExcelDataHandlerDefaultImpl<Student> {
    private ClassesService service = new ClassesServiceImpl();

    @Override
    public Object exportHandler(Student obj, String name, Object value) {
        System.out.println(name+"-"+value);
        if (name.equals("班级")) {
            Map<String,Integer> maps = service.getClassesNames();
            Object classid = maps.get(value);
            if (classid == null){

            }
            return Conver.toInt(classid,0);
        }
        return super.exportHandler(obj, name, value);
    }

    @Override
    public Object importHandler(Student obj, String name, Object value) {
        return super.importHandler(obj, name, value);
    }
}
